package portal.mq;

import java.io.File;
import java.io.Serializable;

public class MessageInfo implements Serializable {
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 文件名
	 * **/
	private String fileName;
	/***
	 * 群发通告，寻找指定节点，默认false,表示该消息对任意节点都有效
	 * 若true 表示，该消息需要指定的 topic对应的节点才需要处理
	 * **/
	private boolean isTopic=false;
	/***
	 * 相关topic,用该节点的ip表示
	 * ***/
	private String topic;
	/***
	 * 发送文件的文件长度，单位字节
	 * **/
    private int fileLength;
    /**
     * 当前发送消息的编号，暂未使用
     * **/
    private int blockNo;
    /**
     * 文件总分割块数
     * **/
    private int totalBlock;
    /**
     * 文件正文信息
     * **/
    private byte[] data;

    public String getFileName() {
        return fileName;
    }

    public MessageInfo(){
        
    }
    public MessageInfo(String file){
        
    }
    public MessageInfo(File file){
        
    }

    public void setFileName(String filename) {
        this.fileName = filename.substring(filename.lastIndexOf("/")+1);
    }

    public int getFileLenth() {
        return fileLength;
    }

    public void setFileLenth(int fileLength) {
        this.fileLength = fileLength;
    }

    public int getBlockNo() {
        return blockNo;
    }

    public void setBlockNo(int blockNo) {
        this.blockNo = blockNo;
    }

    public int getTotalBlock() {
        return totalBlock;
    }

    public void setTotalBolck(int totalBlock) {
        this.totalBlock = totalBlock;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

	public boolean isTopic() {
		return isTopic;
	}

	public String getTopic() {
		return topic;
	}

	public int getFileLength() {
		return fileLength;
	}

	public void setTopic(boolean isTopic) {
		this.isTopic = isTopic;
	}

	public void setTopic(String topic) {
		if(topic==null)return ;
		this.topic = topic;
		this.isTopic=true;
	}

	public void setFileLength(int fileLength) {
		this.fileLength = fileLength;
	}

	public void setTotalBlock(int totalBlock) {
		this.totalBlock = totalBlock;
	}
    
}

